<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8">
    
    <title>Logic functions &mdash; NumPy v1.18 Manual</title>
    
    <link rel="stylesheet" type="text/css" href="../_static/css/spc-bootstrap.css">
    <link rel="stylesheet" type="text/css" href="../_static/css/spc-extend.css">
    <link rel="stylesheet" href="../_static/scipy.css" type="text/css" >
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" >
    <link rel="stylesheet" href="../_static/graphviz.css" type="text/css" >
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.18.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  false
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    <script type="text/javascript" src="../_static/js/copybutton.js"></script>
    <link rel="author" title="About these documents" href="../about.html" >
    <link rel="index" title="Index" href="../genindex.html" >
    <link rel="search" title="Search" href="../search.html" >
    <link rel="top" title="NumPy v1.18 Manual" href="../index.html" >
    <link rel="up" title="Routines" href="routines.html" >
    <link rel="next" title="numpy.all" href="generated/numpy.all.html" >
    <link rel="prev" title="numpy.linalg.LinAlgError" href="generated/numpy.linalg.LinAlgError.html" > 
  </head>
  <body>
<div class="container">
  <div class="top-scipy-org-logo-header" style="background-color: #a2bae8;">
    <a href="../index.html">
      <img border=0 alt="NumPy" src="../_static/numpy_logo.png"></a>
    </div>
  </div>
</div>


    <div class="container">
      <div class="main">
        
	<div class="row-fluid">
	  <div class="span12">
	    <div class="spc-navbar">
              
    <ul class="nav nav-pills pull-left">
        <li class="active"><a href="https://numpy.org/">NumPy.org</a></li>
        <li class="active"><a href="https://numpy.org/doc">Docs</a></li>
        
        <li class="active"><a href="../index.html">NumPy v1.18 Manual</a></li>
        

          <li class="active"><a href="index.html" >NumPy Reference</a></li>
          <li class="active"><a href="routines.html" accesskey="U">Routines</a></li> 
    </ul>
              
              
    <ul class="nav nav-pills pull-right">
      <li class="active">
        <a href="../genindex.html" title="General Index"
           accesskey="I">index</a>
      </li>
      <li class="active">
        <a href="generated/numpy.all.html" title="numpy.all"
           accesskey="N">next</a>
      </li>
      <li class="active">
        <a href="generated/numpy.linalg.LinAlgError.html" title="numpy.linalg.LinAlgError"
           accesskey="P">previous</a>
      </li>
    </ul>
              
	    </div>
	  </div>
	</div>
        

	<div class="row-fluid">
      <div class="spc-rightsidebar span3">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../contents.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Logic functions</a><ul>
<li><a class="reference internal" href="#truth-value-testing">Truth value testing</a></li>
<li><a class="reference internal" href="#array-contents">Array contents</a></li>
<li><a class="reference internal" href="#array-type-testing">Array type testing</a></li>
<li><a class="reference internal" href="#logical-operations">Logical operations</a></li>
<li><a class="reference internal" href="#comparison">Comparison</a><ul>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="generated/numpy.linalg.LinAlgError.html"
                        title="previous chapter">numpy.linalg.LinAlgError</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="generated/numpy.all.html"
                        title="next chapter">numpy.all</a></p>
<div id="searchbox" style="display: none" role="search">
  <h4>Quick search</h4>
    <div>
    <form class="search" action="../search.html" method="get">
      <input type="text" style="width: inherit;" name="q" />
      <input type="submit" value="search" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
          <div class="span9">
            
        <div class="bodywrapper">
          <div class="body" id="spc-section-body">
            
  <div class="section" id="logic-functions">
<h1>Logic functions<a class="headerlink" href="#logic-functions" title="Permalink to this headline">¶</a></h1>
<div class="section" id="truth-value-testing">
<h2>Truth value testing<a class="headerlink" href="#truth-value-testing" title="Permalink to this headline">¶</a></h2>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.all.html#numpy.all" title="numpy.all"><code class="xref py py-obj docutils literal notranslate"><span class="pre">all</span></code></a>(a[, axis, out, keepdims])</p></td>
<td><p>Test whether all array elements along a given axis evaluate to True.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.any.html#numpy.any" title="numpy.any"><code class="xref py py-obj docutils literal notranslate"><span class="pre">any</span></code></a>(a[, axis, out, keepdims])</p></td>
<td><p>Test whether any array element along a given axis evaluates to True.</p></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="array-contents">
<h2>Array contents<a class="headerlink" href="#array-contents" title="Permalink to this headline">¶</a></h2>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.isfinite.html#numpy.isfinite" title="numpy.isfinite"><code class="xref py py-obj docutils literal notranslate"><span class="pre">isfinite</span></code></a>(x, /[, out, where, casting, order, …])</p></td>
<td><p>Test element-wise for finiteness (not infinity or not Not a Number).</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.isinf.html#numpy.isinf" title="numpy.isinf"><code class="xref py py-obj docutils literal notranslate"><span class="pre">isinf</span></code></a>(x, /[, out, where, casting, order, …])</p></td>
<td><p>Test element-wise for positive or negative infinity.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.isnan.html#numpy.isnan" title="numpy.isnan"><code class="xref py py-obj docutils literal notranslate"><span class="pre">isnan</span></code></a>(x, /[, out, where, casting, order, …])</p></td>
<td><p>Test element-wise for NaN and return result as a boolean array.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.isnat.html#numpy.isnat" title="numpy.isnat"><code class="xref py py-obj docutils literal notranslate"><span class="pre">isnat</span></code></a>(x, /[, out, where, casting, order, …])</p></td>
<td><p>Test element-wise for NaT (not a time) and return result as a boolean array.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.isneginf.html#numpy.isneginf" title="numpy.isneginf"><code class="xref py py-obj docutils literal notranslate"><span class="pre">isneginf</span></code></a>(x[, out])</p></td>
<td><p>Test element-wise for negative infinity, return result as bool array.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.isposinf.html#numpy.isposinf" title="numpy.isposinf"><code class="xref py py-obj docutils literal notranslate"><span class="pre">isposinf</span></code></a>(x[, out])</p></td>
<td><p>Test element-wise for positive infinity, return result as bool array.</p></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="array-type-testing">
<h2>Array type testing<a class="headerlink" href="#array-type-testing" title="Permalink to this headline">¶</a></h2>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.iscomplex.html#numpy.iscomplex" title="numpy.iscomplex"><code class="xref py py-obj docutils literal notranslate"><span class="pre">iscomplex</span></code></a>(x)</p></td>
<td><p>Returns a bool array, where True if input element is complex.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.iscomplexobj.html#numpy.iscomplexobj" title="numpy.iscomplexobj"><code class="xref py py-obj docutils literal notranslate"><span class="pre">iscomplexobj</span></code></a>(x)</p></td>
<td><p>Check for a complex type or an array of complex numbers.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.isfortran.html#numpy.isfortran" title="numpy.isfortran"><code class="xref py py-obj docutils literal notranslate"><span class="pre">isfortran</span></code></a>(a)</p></td>
<td><p>Check if the array is Fortran contiguous but <em>not</em> C contiguous.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.isreal.html#numpy.isreal" title="numpy.isreal"><code class="xref py py-obj docutils literal notranslate"><span class="pre">isreal</span></code></a>(x)</p></td>
<td><p>Returns a bool array, where True if input element is real.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.isrealobj.html#numpy.isrealobj" title="numpy.isrealobj"><code class="xref py py-obj docutils literal notranslate"><span class="pre">isrealobj</span></code></a>(x)</p></td>
<td><p>Return True if x is a not complex type or an array of complex numbers.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.isscalar.html#numpy.isscalar" title="numpy.isscalar"><code class="xref py py-obj docutils literal notranslate"><span class="pre">isscalar</span></code></a>(element)</p></td>
<td><p>Returns True if the type of <em class="xref py py-obj">element</em> is a scalar type.</p></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="logical-operations">
<h2>Logical operations<a class="headerlink" href="#logical-operations" title="Permalink to this headline">¶</a></h2>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.logical_and.html#numpy.logical_and" title="numpy.logical_and"><code class="xref py py-obj docutils literal notranslate"><span class="pre">logical_and</span></code></a>(x1, x2, /[, out, where, …])</p></td>
<td><p>Compute the truth value of x1 AND x2 element-wise.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.logical_or.html#numpy.logical_or" title="numpy.logical_or"><code class="xref py py-obj docutils literal notranslate"><span class="pre">logical_or</span></code></a>(x1, x2, /[, out, where, casting, …])</p></td>
<td><p>Compute the truth value of x1 OR x2 element-wise.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.logical_not.html#numpy.logical_not" title="numpy.logical_not"><code class="xref py py-obj docutils literal notranslate"><span class="pre">logical_not</span></code></a>(x, /[, out, where, casting, …])</p></td>
<td><p>Compute the truth value of NOT x element-wise.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.logical_xor.html#numpy.logical_xor" title="numpy.logical_xor"><code class="xref py py-obj docutils literal notranslate"><span class="pre">logical_xor</span></code></a>(x1, x2, /[, out, where, …])</p></td>
<td><p>Compute the truth value of x1 XOR x2, element-wise.</p></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="comparison">
<h2>Comparison<a class="headerlink" href="#comparison" title="Permalink to this headline">¶</a></h2>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.allclose.html#numpy.allclose" title="numpy.allclose"><code class="xref py py-obj docutils literal notranslate"><span class="pre">allclose</span></code></a>(a, b[, rtol, atol, equal_nan])</p></td>
<td><p>Returns True if two arrays are element-wise equal within a tolerance.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.isclose.html#numpy.isclose" title="numpy.isclose"><code class="xref py py-obj docutils literal notranslate"><span class="pre">isclose</span></code></a>(a, b[, rtol, atol, equal_nan])</p></td>
<td><p>Returns a boolean array where two arrays are element-wise equal within a tolerance.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.array_equal.html#numpy.array_equal" title="numpy.array_equal"><code class="xref py py-obj docutils literal notranslate"><span class="pre">array_equal</span></code></a>(a1, a2)</p></td>
<td><p>True if two arrays have the same shape and elements, False otherwise.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.array_equiv.html#numpy.array_equiv" title="numpy.array_equiv"><code class="xref py py-obj docutils literal notranslate"><span class="pre">array_equiv</span></code></a>(a1, a2)</p></td>
<td><p>Returns True if input arrays are shape consistent and all elements equal.</p></td>
</tr>
</tbody>
</table>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.greater.html#numpy.greater" title="numpy.greater"><code class="xref py py-obj docutils literal notranslate"><span class="pre">greater</span></code></a>(x1, x2, /[, out, where, casting, …])</p></td>
<td><p>Return the truth value of (x1 &gt; x2) element-wise.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.greater_equal.html#numpy.greater_equal" title="numpy.greater_equal"><code class="xref py py-obj docutils literal notranslate"><span class="pre">greater_equal</span></code></a>(x1, x2, /[, out, where, …])</p></td>
<td><p>Return the truth value of (x1 &gt;= x2) element-wise.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.less.html#numpy.less" title="numpy.less"><code class="xref py py-obj docutils literal notranslate"><span class="pre">less</span></code></a>(x1, x2, /[, out, where, casting, …])</p></td>
<td><p>Return the truth value of (x1 &lt; x2) element-wise.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.less_equal.html#numpy.less_equal" title="numpy.less_equal"><code class="xref py py-obj docutils literal notranslate"><span class="pre">less_equal</span></code></a>(x1, x2, /[, out, where, casting, …])</p></td>
<td><p>Return the truth value of (x1 =&lt; x2) element-wise.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.equal.html#numpy.equal" title="numpy.equal"><code class="xref py py-obj docutils literal notranslate"><span class="pre">equal</span></code></a>(x1, x2, /[, out, where, casting, …])</p></td>
<td><p>Return (x1 == x2) element-wise.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.not_equal.html#numpy.not_equal" title="numpy.not_equal"><code class="xref py py-obj docutils literal notranslate"><span class="pre">not_equal</span></code></a>(x1, x2, /[, out, where, casting, …])</p></td>
<td><p>Return (x1 != x2) element-wise.</p></td>
</tr>
</tbody>
</table>
</div>
</div>


          </div>
        </div>
          </div>
        </div>
      </div>
    </div>

    <div class="container container-navbar-bottom">
      <div class="spc-navbar">
        
      </div>
    </div>
    <div class="container">
    <div class="footer">
    <div class="row-fluid">
    <ul class="inline pull-left">
      <li>
        &copy; Copyright 2008-2019, The SciPy community.
      </li>
      <li>
      Last updated on Feb 20, 2020.
      </li>
      <li>
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 2.4.2.
      </li>
    </ul>
    </div>
    </div>
    </div>
  </body>
</html>